Advanced databases are providing functionality similar to conventional business warehouse architectures by handling more complex calculations. For example, databases can calculate the count distinct of attributes such as count distinct on customers for each region. In order to calculate such a query, different aggregation levels and intermediate results must be combined. Such operations are typically done by using a join operation that can unnecessarily consume time, processing resources, and/or memory.